#!/usr/bin/env bash

export PROJECT_ID=$(gcloud info --format='value(config.project)')

GKE_CLUSTER=spin-demo
ZONE=us-west1-b

if [ -f bucket.txt ]; then
  export BUCKET_NAME=$(cat bucket.txt)
else
  export BUCKET_NAME="spin-gcs-bucket-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 20 | head -n 1)-$(date +"%s")"
  echo $BUCKET_NAME > bucket.txt
fi

export BUCKET_URI="gs://$BUCKET_NAME"

if [ -f account.txt ]; then
  SERVICE_ACCOUNT_NAME=$(cat account.txt)
else
  SERVICE_ACCOUNT_NAME="spin-acc-$(date +"%s")"
  echo $SERVICE_ACCOUNT_NAME > account.txt
fi

export GCS_TOPIC="spin-gcs-topic"
export GCS_SUB="spin-gcs-sub"
export GCR_TOPIC="projects/${PROJECT_ID}/topics/gcr"
export GCR_SUB="spin-gcr-sub"

export SPIN_GCS_ACCOUNT="my-gcs-account"

export SPIN_GCS_PUB_SUB="my-gcs-pub-sub"
export SPIN_GCR_PUB_SUB="my-gcr-pub-sub"

export SPINNAKER_VERSION='$(hal version latest --daemon-endpoint http://spin-halyard.spinnaker:8064 -q)'
